package com.rd.student.jike.class2.xuezhixin.day0801;

import java.util.Scanner;

public class Test2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] arr = {1,3,5,7,9,11,13,15,17};
        for (int i = 0;i<arr.length;i++){
            System.out.print(arr[i] + "  ");
        }
        System.out.println("\t" + "请输入您要删除的数字：");
        int num = scanner.nextInt();

        int len = -1;
        for (int i = 0;i<arr.length;i++){
            if (arr[i] == num){
                len = i;
                break;
            }
        }
        if (len == -1){
            System.out.println("您输入数字该数组不存在");
        }

        int[] arr1 = new int[arr.length];
        System.arraycopy(arr,0,arr1,0,len);
        System.arraycopy(arr,len+1,arr1,len,arr.length - len -1);

        for (int i = 0;i<arr1.length;i++){
            System.out.print(arr1[i] + "  ");
        }
    }
}
